<template>
  <div class="app-container">
    <RDBMSWriter v-show="dataSourceType!=='hive' && dataSourceType!=='hbase' && dataSourceType!=='mongodb'" ref="rdbmswriter" @select-data-source="showDataSource" />
  </div>
</template>

<script>
import RDBMSWriter from './writer/RDBMSWriter.vue'
export default {
  name: 'Writer',
  components: { RDBMSWriter },
  data() {
    return {
      dataSourceType: ''
    }
  },
  methods: {
    getData() {
      if (this.dataSourceType === 'mongodb') {
  
      } else {
        return this.$refs.rdbmswriter.getData()
      }
    },
    //by zwb: 发送reader页面字段名称 给 writer
    sendColumns(fromColumnList) {
      return this.$refs.rdbmswriter.sendColumns(fromColumnList)
    },
    getTableName() {
       if (this.dataSourceType === 'mongodb') {
      } else {
        return this.$refs.rdbmswriter.getTableName()
      }
    },
    getReaderData() {
      return this.$parent.getReaderData()
    },
    showDataSource(data) {
      this.dataSourceType = data
      this.getData()
    },
    // sendTableNameAndColumns(fromTableName, fromColumnList) {
    //   this.$refs.hivewriter.fromTableName = fromTableName
    //   this.$refs.hivewriter.fromColumnList = fromColumnList
    // },
    resetForm() {
      if (this.dataSourceType === 'mongodb') {
      } else {
        return this.$refs.rdbmswriter.resetForm()
      }
    }
  }
}
</script>
